import time
from selenium.webdriver.common.by import By
# float(result2[5:-1])
# from LoginData import LoginData1
class LoginOperation:
 # 登陆的逻辑操作
    def login(self,driver,username,password):
        # 4.输入用户名

        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(int(password))
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(2)



 #获取成功实际结果
    def  getSuccessResult(self,driver):
        return driver.title
# 获取用户名失败的结果
    def  getNameErrorresult(self,driver):
        return  driver.find_element(By.XPATH,"/html/body/div/div/div/form/div[1]/span[1]").text # Text获取里面的文本数据
    #获取密码错误的结果
    def  getPasswordErrorresult(self,driver):
        return   driver.find_element(By.XPATH,"/html/body/div/div/div/form/div[2]/span[1]").text









